You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
zonemap for array type columns are not initialized
PR Type
Bug fix
Description
Disable zonemap filtering for array type columns
Add explicit check for T_array_float32 and T_array_float64 types
Prevent uninitialized zonemap access for array columns
Diagram Walkthrough
flowchart LR
A["ExprIsZonemappable function"] --> B["Check expression type"]
B --> C["Column expression detected"]
C --> D["Array type check"]
D --> E["Return false for arrays"]
D --> F["Return true for non-arrays"]
Loading
File Walkthrough
Relevant files
Bug fix
utils.go
Add array type zonemap filtering exclusion
pkg/sql/plan/utils.go
Added new case handler for plan.Expr_Col expression type
Implemented check to detect array types (T_array_float32, T_array_float64)
Returns false for array types to disable zonemap filtering
Returns true for non-array column types to allow zonemap filtering
Objective: To create a detailed and reliable record of critical system actions for security analysis and compliance.
Status: No logging: The new logic adds early-return conditions without any audit logging of the decision or context, which may hinder traceability of critical planning decisions.
Generalize the array type check to be more robust and future-proof. Instead of checking for specific array types, use a prefix check on the type's string representation to disable zonemapping for all array types.
case *plan.Expr_Col:
// Array types don't support zonemapping
- if expr.Typ.Id == int32(types.T_array_float32) || expr.Typ.Id == int32(types.T_array_float64) {+ if strings.HasPrefix(types.T(expr.Typ.Id).String(), "T_array") {
return false
}
return true
Apply / Chat
Suggestion importance[1-10]: 6
__
Why: The suggestion correctly identifies that the hardcoded check for specific array types is brittle and proposes a more robust prefix-based check, making the code more maintainable and future-proof.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
What type of PR is this?
Which issue(s) this PR fixes:
issue #22795
What this PR does / why we need it:
zonemap for array type columns are not initialized
PR Type
Bug fix
Description
Disable zonemap filtering for array type columns
Add explicit check for T_array_float32 and T_array_float64 types
Prevent uninitialized zonemap access for array columns
Diagram Walkthrough
File Walkthrough
utils.go
Add array type zonemap filtering exclusionpkg/sql/plan/utils.go
plan.Expr_Colexpression typeT_array_float64)